package com.ikas.ai.server.module.instance.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ikas.ai.server.module.instance.dao.WorkInstanceStepDetailDao;
import com.ikas.ai.server.module.instance.model.WorkInstanceStepDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 工况转换实例步骤明细表
 *
 * @author hu.bowei
 * @email hu.bowei@ikasinfo.com
 * @date 2023-05-06 17:27:58
 */
@Service
public class WorkInstanceStepDetailService extends ServiceImpl<WorkInstanceStepDetailDao, WorkInstanceStepDetail> {

    @Autowired
    private WorkInstanceStepDetailDao workInstanceStepDetailDao;


    public List<WorkInstanceStepDetail> getListByInstanceId(Long instanceId) {
        LambdaQueryWrapper<WorkInstanceStepDetail> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(WorkInstanceStepDetail::getWfInstanceId, instanceId);
        return workInstanceStepDetailDao.selectList(queryWrapper);
    }

    public List<WorkInstanceStepDetail> getListByMeteCode(Long instanceId, String meteCode) {
        LambdaQueryWrapper<WorkInstanceStepDetail> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(WorkInstanceStepDetail::getWfInstanceId, instanceId);
        queryWrapper.eq(WorkInstanceStepDetail::getMeteCode, meteCode);
        return workInstanceStepDetailDao.selectList(queryWrapper);
    }
}